module(..., package.seeall) -- 使得文件中的函数在何处都可调用

require "sys"
require "mqttOutMsg"
require "nvm"


-- 参数配置文件初始化
nvm.init("config.lua", true)

local clientNo = nvm.get("info")[1]

local slen, offllineData = string.len, ""

function restartDevice()
    offllineData = "{" .. "clientNo:'" .. clientNo .. "',msg:'0'" .. "}"
    offllineData = crypto.aes_encrypt("ECB", "PKCS5", offllineData, "keson-123abcdefg")
    offllineData = crypto.base64_encode(offllineData, slen(offllineData))
    log.info("offllineData:", offllineData)
    mqttOutMsg.insertMsg("online", offllineData, 0)
    sys.waitUntil("ONLINE_OR_OFFLINE_SEND_DATA")
    sys.restart("重启设备！")
end
